package view.components.text {
	
	/**
	 * @author Alejandro
	 */
	
	import flash.text.TextField;
	 
	public class AbstractEstructureText extends TextField {
		
		public var properties:Object = {		
			font:            "Arial",
			size:            null,
			underline:       false,	
			backgroundColor: 0xFFFFFF,
			color:           0xFFFFFF,
			x:               0,
			y:               0,
			height:          50,
			width:           100,
			visible:         true,
			align:           "center",
			text:            ""
		};
		
		
		public function AbstractEstructureText(properties_V:Object) {
			cloneProperties(properties, properties_V);
			
			if(properties_V.hasOwnProperty("size")){
				properties.size = properties_V.size;
			}
			else {
				properties.size = calculateSize();
			}
		}
		
		private function calculateSize():Number{
			return properties.height/1.5;
		}
		
		private function cloneProperties(properties_S:Object, properties_V:Object):void{
			for (var property:String in properties_S) {
				if (properties_V.hasOwnProperty(property)) {
					properties_S[property] = properties_V[property];
				}
			}
		}
		
	}
}